// E.cpp WA 戴朋代码 ，待调试
// #define fre 1
#include <bits/stdc++.h>
#define mp(a, b) make_pair(a, b)
using namespace std;
// #define int long long
typedef long long ll;
typedef unsigned long long ull;
const int inf = 10000000;

int main() { 
  int n, h, m;
  cin >> n >> h >> m;
  vector<int> a(n), b(n);
  for (int i = 1; i <= n; i++) {
    cin >> a[i] >> b[i];
  }
  vector<vector<int>> dp(n + 1, vector<int>(h + 1, inf));

  // dp[i][x];
  dp[0][0] = 0;
  for (int i = 0; i < n; i++) {
    for (int j = 0; j <= h; j++) {
      if (dp[i][j] == inf) {
        continue;
      }
      if (j + a[i] <= h) {
        if (dp[i + 1][j + a[i]] > dp[i][j]) {
          dp[i + 1][j + a[i]] = dp[i][j];
        }
      }
      if (dp[i + 1][j] > dp[i][j] + b[i]) {
        dp[i + 1][j] = dp[i][j] + b[i];
      }
    }
  }
  for (int i = n; i >= 0; i--) {
    for (int j = 0; j <= h; j++) {
      if (dp[i][j] <= m) {
        cout << i << endl;
        return 0;
      }
    }
  }
  cout << 0 << endl;
  return 0;
}